package cn.hiapi.core.basic.exception;


import cn.hiapi.core.basic.response.BasicResponseCode;

/**
 * @author AdinZ
 * @date 2020/5/7 8:17 下午
 */
public class BasicException extends RuntimeException {

    private final int code;

    public BasicException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public BasicException(String message) {
        this(500, message, null);
    }

    public BasicException(BasicResponseCode code) {
        this(code.getCode(), code.getRemark(), null);
    }


    public BasicException(String message, Throwable cause) {
        this(500, message, cause);
    }

    public BasicException(int code, String message) {
        this(code, message, null);
    }


    public int getCode() {
        return code;
    }
}
